package com.triones.api.runner;

import com.triones.api.service.GlobalAccountService;
import com.triones.api.service.third.InterlaceService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

/**
 * 初始化 api 模块对应业务数据
 *
 * @author Lion Li
 */
@Slf4j
@RequiredArgsConstructor
@Component
public class ApiApplicationRunner implements ApplicationRunner {

    private final GlobalAccountService globalAccountService;

    private final InterlaceService interlaceService;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        log.info("初始化...");
        interlaceService.oauthAccessToken();
        log.info("启动加载访问令牌");
        interlaceService.initMasterAccountWallet();
        log.info("初始主账户钱包信息");
        interlaceService.initMasterBalance();
        log.info("初始主账户余额信息");
    }
}
